package com.gx.controller.auth;

import com.gx.dto.base.result.Results;
import com.gx.dto.base.result.SingleResult;
import com.gx.dto.command.LoginCmd;
import com.gx.service.AuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "授权管理")
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Resource
    private AuthService authService;

    @ApiOperation("登录")
    @PostMapping("login")
    public SingleResult<String> login(@RequestBody LoginCmd loginCmd){
        String a = authService.login(loginCmd);
        return Results.buildResult(a);
    }
}
